<?php
include_once ('code_parents.php');
class code_fragment extends code_parents {
	private $CI;
	private $baseUrl;
	private $userId;
	function __construct() {
		$CI = & get_instance ();
		$this->CI = $CI;
		$CI->load->helper ( 'url' );
		$this->baseUrl = $CI->config->base_url ();
		$this->userId = $CI->session->userdata ( "userId" );
	}
	function tsHytjCode($data, $isClear) {
		$icon = empty ( $data ["userBigIcon"] ) ? 'assets/images/uploads/andrew.png' : $data ["userBigIcon"];
		$icon = $this->baseUrl . $icon;
		$rfId = $data ["rfId"];
		$perserteeName = $data ["perserteeName"];
		$nickName = $data ["nickName"];
		$addCode = $isClear == 0 ? "" : "<div class='clear'></div>";
		return $addCode . "<img src='$icon' width='64' height='63' /><span>$nickName</span><div class='cont_rgp1_r'><p>引荐人:$perserteeName</p><p><a class='agree' href='#' title='$rfId' >同意</a> <a class='refuse' title='$rfId' href='#'>拒绝</a></p></div>";
	}
	function tsHytj($data) {
		$divCode = "<p class='cont_rgp1'></p><div class='cont_rgd1' id='user_ts_hytj'>";
		$code = "";
		foreach ( $data as $key => $row ) {
			$code .= $this->tsHytjCode ( $row, $key );
		}
		$code = empty ( $code ) ? "<span>没有好友推荐信息</span>" : $code;
		return $divCode . $code . "</div>";
	}
	function userShowDynamicArrange($data) {
		extract ( $data );
		$arrayImg = explode ( ",", $imageUrl );
		$showContent = "";
		$strImg = "";
		$title = $this->cn_substr_utf8 ( $title, 40 );
		foreach ( $arrayImg as $val ) {
			if (! empty ( $val ))
				$strImg .= "<img src='$val' width='109' height='109' />&nbsp;&nbsp;";
		}
		
		if ($type == "image") {
			$showContent .= "图片";
			$showContent .= "<div class='bmlf_lfwj32'>";
			$showContent .= "<p class='bmlf_lfwj321'>$content</p>";
			$showContent .= "<p class='bmlf_lfwj322'>$strImg</p>";
			$showContent .= "</div>";
		} elseif ($type == "video") {
			$showContent .= "视频 ";
			$showContent .= "<div class='bmlf_lfwj32'>";
			$showContent .= "<p class='bmlf_lfwj321'>$title ($description)</p>";
			$showContent .= str_replace ( 'width="480"', 'width="440"', $content );
			$showContent .= "<p class='bmlf_lfwj322'>$strImg</p>";
			$showContent .= "</div>";
		} elseif ($type == "links") {
			$showContent .= "链接 ";
			$showContent .= "<div class='bmlf_lfwj32'>";
			$showContent .= "<p class='bmlf_lfwj321'>$title</p>";
			$showContent .= "<p class='bmlf_lfwj322'>$content</p>";
			$showContent .= "</div>";
		} else {
			$showContent .= "说说 ";
			$showContent .= "<div class='bmlf_lfwj32'>";
			//$showContent .= "<p class='bmlf_lf321'>$title</p>";
			$showContent .= "<p class='bmlf_lfwj322'>$content</p>";
			$showContent .= "</div>";
		}
		return $showContent;
	}
	function tsQzf($data) {
		$divCode = "<div class='cont_rg2'><p class='cont_rgp2'></p>";
		foreach ( $data as $row ) {
			$icon = $this->getUserIcon ( $row ["userBigIcon"] );
			$birthday = $row ["birthday"];
			$divCode .= "<div class='cont_rgd2'>";
			$divCode .= "<p class='cont-rgdp1'><img src='$icon' width='64' height='63' /></p>";
			$divCode .= "<p class='cont-rgdp2'><a href='#'><strong class='rgdp2_str'>夜熙晓</strong></a><strong class='rgdp2_str2'>$birthday</strong></p>";
			$divCode .= "<p class='cont-rgdp3' id='best_btn4'><a class='ts_qzf_send_click' href='#'><img src='$this->baseUrl/assets/images/nj_20.gif' width='50' height='23' /></a></p>";
			$divCode .= "</div>";
			$divCode .= "<p class='cont_rgp3'></p>";
		}
		$divCode .= '</div>';
		return $divCode;
	}
	function tsRemind($data, $width = "100%") {
		$divCode = "<table border='0'' width='$width'>";
		foreach ( $data as $row ) {
			$icon = $this->getUserIcon ( $row ["userBigIcon"] );
			$nickName = $row ['nickName'];
			$birthday = $row ["birthday"];
			$divCode .= "<tr>";
			$divCode .= "<td width='10%'><img src='
			$icon'></td>";
			$divCode .= "<td width='3%' align='right'><img src='$this->baseUrl/assets/images/grzy_0300.gif'></td>";
			$divCode .= "<td bgcolor='#FFFFFF'>";
			$divCode .= "<span style='display:block; background-color:#FFF;'>";
			$divCode .= "<div style='padding-left:10px;'>好友<font color='#FF0000'>$nickName</font>在$birthday 过上日，快送祝福吧!</div>";
			//$divCode .="<div style='margin-left:340px;'>2013年3月23日</div>";
			$divCode .= "</span>";
			$divCode .= "</td>";
			$divCode .= "</tr>";
			$divCode .= "<tr height='10'><td></td><td></td><td></td></tr>";
		}
		if (empty ( $data )) {
			$divCode .= "暂时没有动态提醒";
		}
		$divCode .= '</table>';
		return array ("divCode" => $divCode );
	
	}
	function tsDynamic($data) {
		$divCode = "";
		
		foreach ( $data as $row ) {
			$divCode .= $this->tsDynamicType ( $row ["items"] );
		}
		if (empty ( $data )) {
			
			$divCode .= "暂时没有动态";
		}
		return array ("divCode" => $divCode );
	
	}
	
	function tsDynamicType($data, $width = "100%") {
		$divCode = "<table border='0'' width='$width'>";
		foreach ( $data as $row ) {
			$icon = $this->getUserIcon ( $row ["userBigIcon"] );
			$icon = $this->baseUrl . $icon;
			$nickName = $row ['nickName'];
			$birthday = date ( "Y-d-m", strtotime ( $row ["createTime"] ) );
			$content = $this->userShowDynamicArrange ( $row );
			$divCode .= "<tr>";
			$divCode .= "<td width='10%'><img src='
			$icon'></td>";
			$divCode .= "<td width='3%' align='right'><img src='$this->baseUrl/assets/images/grzy_0300.gif'></td>";
			$divCode .= "<td bgcolor='#FFFFFF'>";
			$divCode .= "<span style='display:block; background-color:#FFF;'>";
			$divCode .= "<div style='padding-left:10px;'>好友<font color='#FF0000'>$nickName</font>在$birthday 发布新 动态  $content</div>";
			//$divCode .="<div style='margin-left:340px;'>2013年3月23日</div>";
			$divCode .= "</span>";
			$divCode .= "</td>";
			$divCode .= "</tr>";
			$divCode .= "<tr height='10'><td></td><td></td><td></td></tr>";
		}
		if (empty ( $data )) {
			$divCode .= "暂时没有动态提醒";
		}
		$divCode .= '</table>';
		return $divCode;
	
	}
	function codeHytj() {
		$array = array ();
		$jsFile = $this->baseUrl . "assets/js/grzy/friendsreferral.js";
		$array ["user_model_title"] = '<strong class="photos_title">好友引荐</strong>在这里你可以将你所在的团队的好友介绍别的团队,促使双方更快速的相识';
		$array ["user_model_button"] = '<a href="#" id="referralSend"><img src="' . $this->baseUrl . 'assets/images/photos_02.gif" width="134" height="33" />';
		$array ["user_model_js"] = "<script type='text/javascript' src='$jsFile'></script>";
		$array ["user_model_js_function"] = "friendsreferralInit('" . $this->baseUrl . "index.php/',$this->userId);";
		$array ["user_model_leftList"] = '好友列表';
		$array ["user_model_rightList"] = '我所在的团队';
		return $this->addTreeDiv ( $array );
	}
	function codeQzf() {
		$jsFile = $this->baseUrl . "assets/js/grzy/friendsqzf.js";
		$array ["user_model_title"] = '<strong class="photos_title">群祝福</strong>邀请你的好友,在你喜欢的日期向你的某一个好友送去一群人的祝福被祝福的好友个人公共页面会显示该祝福';
		//$array ["user_model_button"] = '<a href="#" id="qzfSend"><img src="' . $this->baseUrl . 'assets/images/photos_02.gif" width="134" height="33" />';
		$array ["user_model_leftList"] = '好友列表';
		$array ["user_model_rightList"] = '你要祝福的人';
		$array ["user_model_js"] = "<script type='text/javascript' src='$jsFile'></script>";
		$array ["user_model_js_function"] = "friendsqzfInit('" . $this->baseUrl . "index.php/',$this->userId);";
		
		return $this->addTreeDiv ( $array );
	}
	function codeYearbook($data) {
		$jsFile = $this->baseUrl . "assets/js/grzy/friendsyearbook.js";
		$array ["user_model_js"] = "<script type='text/javascript' src='$jsFile'></script>";
		$array ["user_model_js_function"] = "friendsyearbookInit('" . $this->baseUrl . "index.php/','$data','$this->userId');";
		return $this->addYearbookDiv ( $array );
	}
	function addYearbookDiv($data) {
		$year = date ( "Y" );
		$month = date ( "m" );
		$day = date ( "d" );
		$divCode = "<p class='bmlf_lf221'><strong class='photos_title'>年鉴</strong>这里可你可以记录你自己以及团队的有重要意义的日子,并添加图片加以说明</p><div class='clear'></div>";
		$divCode .= "<div class='tjnj'><input type='button' class='tjnj_btn' id='tjnj_btn_personal' /><input type='button' id='tdnj_btn' class='tdnj_btn' /> <input type='hidden' id='yearbookRelegation' />	<input type='hidden' id='yearbookType'/> </div>";
		$divCode .= "<p class='bmlf_lfput'><input type='text' id='yearbookYearDate' value=$year class='lfput_txt3' /><strong>年</strong><input type='text' value=$month id='yearbookMonthDate' class='lfput_txt4' /><strong>月</strong><input id='yearbookDayDate' value=$day type='text' class='lfput_txt5' /><strong>日</strong></p>";
		$divCode .= "<p class='bmlf_lfput'><input type='text' class='lfput_txt6' id='character'  value='人物'/></p>";
		$divCode .= "<p class='bmlf_lfput'><input type='text' class='lfput_txt7' id='address' value='在哪里'/></p>";
		$divCode .= "<p class='bmlf_lfput'><input type='text' class='lfput_txt8' id='content' value='发生了什么'/></p>";
		$divCode .= "<p class='bmlf_lfput'><input type='text' class='lfput_txt9' id='inspiron' value='事件意义'/></p>";
		$divCode .= "<form id='submitYearbookForm' method='post'  action='' enctype='multipart/form-data'><p class='bmlf_lfput bmlf_lfpic' ><img id='yearbookImgCon' src='$this->baseUrl/assets/images/nj_11.gif' width='109' height='109' /><input type='file' name='file' id='yearbookFile' class='yearbookFile'/><input type='button' class='yearbooksubmit' id='yearbooksubmit'/></p></form>";
		$data ['divCode'] = $divCode;
		return $data;
	}
	/**
	 * 此方法拼接 群祝福 好友推荐 功能 DIV。
	 * Enter description here ...
	 * @param Array $data
	 */
	function addTreeDiv($data) {
		$user_model_title = $data ["user_model_title"];
		$user_model_leftList = $data ["user_model_leftList"];
		$user_model_rightList = $data ["user_model_rightList"];
		$divCode = "<p class='bmlf_lf221' >$user_model_title</p>";
		$divCode .= "<div class='qzf_d1'>";
		$divCode .= "<div id='friendTip'></div>";
		$divCode .= "<form id='submitForm'>";
		$divCode .= "<input type='hidden' id='hidIsReferralId'  name='userId'/>";
		$divCode .= "<input type='hidden' id='hidRferralId' value='2' name='perserteeId'/>";
		$divCode .= "<input type='hidden' id='hidFriendId' value='2' name='accepterId'/>";
		//$divCode .= "<input type='hidden' id='dynamicShowType' value='2' name='dynamicShowType'/>";
		$divCode .= "</form>";
		$divCode .= "<div class='qzf_lfd1'>";
		$divCode .= "<h3>$user_model_leftList</h3>";
		$divCode .= "<div id='jqxTree'></div>";
		$divCode .= "</div>";
		$divCode .= "<div class='qzf_lfd1 qzf_rgd2'>";
		$divCode .= "<h3>$user_model_rightList</h3>";
		$divCode .= "<div  name='tree' id='teamjqxTree'></div>";
		$divCode .= "</div>";
		$divCode .= "</div><!-- end qzf_d1 -->";
		$divCode .= "<p class='qzf_p1'><a href='#' id='qzfSend'><img src='" . $this->baseUrl . "assets/images/photos_02.gif' width='134' height='33' /></p>";
		return array ("divCode" => $divCode, "user_model_js_function" => $data ["user_model_js_function"], "user_model_js" => $data ["user_model_js"] );
	}
	function getUserOptDynamicCode($type, $data = '') {
		$code = array ();
		switch ($type) {
			case 'hytj' :
				$code = $this->codeHytj ();
				break;
			case 'qzf' :
				$code = $this->codeQzf ();
				break;
			case 'yearbook' :
				$code = $this->codeYearbook ( $data );
				break;
			case 'photowall' :
				$code = $this->codePhotowall ();
				break;
			case "remind" :
				$code = $this->tsRemind ( $data );
				break;
			case "dynamic" :
				$code = $this->tsDynamic ( $data );
				break;
			case "zhiwo" :
				$code = $this->codeZhiwo ();
				break;
			default :
				$code = "系统繁忙，请稍后再试";
				break;
		}
		if ($type != "remind" && $type != "dynamic") {
			$code ["divCode"] = "<div class='bmlf_lf21'></div><div class='bmlf_lf22'>" . $code ["divCode"] . "</div><div class='bmlf_lf23'></div>";
		}
		return $code;
	}
	function codePhotowall() {
		$array = array ();
		$jsFile = $this->baseUrl . "assets/js/grzy/friendsphotowall.js";
		$photoImage = $this->getBaseUrl("index.php/photo/previewImages/".$this->CI->session->userdata ( "userId" ));
		$array ["user_model_js"] = "<script type='text/javascript' src='$jsFile'></script>";
		$array ["user_model_js_function"] = "friendsphotowallInit('" . $this->baseUrl . "index.php/');";
		$divCode = "<p class='bmlf_lf221'><strong class='photos_title'>照片墙</strong>这里是你发现收藏分享图片的平台</p>";
		$divCode .= "<div class='photos_d1'><a target='blank' href='$photoImage'><img id='enter_photowall' src='" . $this->baseUrl . "assets/images/photos_01.gif' width='120' height='180' /></a></div>";
		$divCode .= "<p class='photos_p1'><input type='button' id='qzfSend' class='fachu_btn' /></p>";
		$array ["divCode"] = $divCode;
		log_message ( "info", json_encode ( $array ) );
		return $array;
	}
	function codeZhiwo() {
		$array = array ();
		$this->CI->load->library("code_user_tag");
		$jsFile = $this->baseUrl . "assets/js/grzy/friendsphotowall.js";
		$array ["user_model_js"] = "<script type='text/javascript' src='$jsFile'></script>";
		$array ["user_model_js_function"] = "friendsphotowallInit('" . $this->baseUrl . "index.php/');";
		$divCode = "<p class='bmlf_lf221'><strong class='photos_title' style='padding-top:16px;'>知我</strong>懒于填写自己的个人资料? 想知道好友对你了解多少?同一团体主页好友可以相互根据自己的了解帮助对方完善资料。</p>";
		//$divCode .= "<div class='photos_d1'><a href='#'><img id='enter_photowall' src='" . $this->baseUrl . "assets/images/photos_01.gif' width='120' height='180' /></a></div>";
		$divCode .= $this->CI->code_user_tag->userTag();
		$array ["divCode"] = $divCode;
		log_message ( "info", json_encode ( $array ) );
		return $array;
	}
	
	function userNameDelTag($data) {
		$name = $data ['nickName'];
		return "<div class='blue_bq'><div class='zhiwo_bq_l_hover'><input type='button' class='zw_bq_close' /></div><div class='zhiwo_bq_c_hover'>$name</div><div class='zhiwo_bq_r_hover'></div></div>";
	}
	
	function homeDynamicDiv($data, $state, $type) {
		$divCode = "";
		
		if (! empty ( $data )) {
			foreach ( $data as $row ) {
				switch ($type) {
					case "yearbook" :
						$divCode .= $this->yearbookTag ( $row, 'home', $state );
						break;
					case "photowall" :
						$divCode .= $this->photowallTag ( $row, $state );
						break;
					case "team" :
						$divCode .= $this->teamTag ( $row, $state );
						break;
				}
			}
		}
		return $divCode;
	}
	function teamJs() {
		$divCode = "<script type='text/javascript'>";
		$divCode .= "$(document).ready(function () {";
		$divCode .= "$('#home_add_friend').click(function(){";
		$divCode .= "$.post('$para',{userId:'$userId',accepterId:'$accepterId',perserteeName:'$nickName',perserteeId:'$userId'},function(data){";
		$divCode .= "$('#dialogDiv').wjDialog({url:'$this->baseUrl/index.php/',content:data});";
		$divCode .= "});";
		$divCode .= "});";
		$divCode .= "});";
		$divCode .= "</script>";
	}
	function teamTag($data, $state) {
		extract ( $data );
		$teamIcon = $this->getUserIcon ( $teamIcon, 'assets/images/search_07.gif' );
		// empty ( $teamIcon ) ? $this->baseUrl . 'assets/images/search_07.gif' : $teamIcon;
		$createTime = date ( 'Y年m月', strtotime ( $createTime ) );
		$teamDescription = empty ( $teamDescription ) ? '暂无简介' : $teamDescription;
		$divCode .= "<div class='home_search_list_bg'>";
		$divCode .= "<img src='$teamIcon' width='62' height='62' />";
		$divCode .= "<div class='search_list_txt'>";
		$divCode .= "<h1>$teamName<span>创建于：$createTime</span></h1>";
		$divCode .= "<p class='txt_area'>$teamDescription</p>";
		$divCode .= "</div>";
		$divCode .= "<a href='$this->baseUrl/index.php/team/index/$teamId'>访问主页</a>";
		$divCode .= ($state == 1) ? "<a class='eventClass' deleId='$id'>脱离团队</a>" : "";
		$divCode .= "</div>";
		return $divCode;
	}
	function getPersonalTag($data, $state) {
		
		$divCode = "<div class='search_menu'>";
		$divCode .= "<div style='float:left; padding-top:5px; padding-right:5px;'><img src='$this->baseUrl/assets/images/bmlf_06.gif'/></div>";
		$divCode .= "<ul><li><div class='search_nav_c'></div></li></ul>";
		$divCode .= "<div class='clear'></div>";
		$divCode .= "</div>";
		foreach ( $data as $row ) {
			$divCode .= $this->personalTag ( $row, $state );
		}
		log_message ( "info", "divConde friend list===>" . json_encode ( $data ) );
		return $divCode;
	}
	function personalTag($data, $state) {
		extract ( $data );
		$userIcon = $this->getUserIcon ( $friendIcon );
		$home_url = $this->baseUrl . 'index.php/user_home/index/' . $friendId;
		$sex = empty ( $friendSex ) ? '男' : $friendSex;
		$divCode = "<div class='search_list_bg_wj'>";
		$divCode .= "<img src='$userIcon' width='62' height='62'>";
		$divCode .= "<div class='search_list_txt'>";
		$divCode .= "<p>$friendName</p><p>$sex</p><p>$friendTags</p>";
		$divCode .= "</div>";
		$divCode .= "<a  href='$home_url'>访问主页</a><a deleId='$id' class='eventClass' style='cursor:pointer;' >删除好友</a>";
		$divCode .= "</div>";
		return $divCode;
	}
	function photowallTag($data, $state) {
		extract ( $data );
		//$divCode = ($state == 1) ? "<div class='home_photowall'><div class='home_photowall_child'><div class='upload_photo'><a><img src='$this->baseUrl/assets/images/wdxx_10.gif'><span>上传照片</span></a></div>  " : "";
		$divCode = "<div class='zpq_photo'>";
		$divCode .= "<script type='text/javascript'>";
		$divCode .= "$(document).ready(function () {";
		$divCode .= "$('#myGallery ul').wjPhotowall({source:$result});";
		$divCode .= "$('#myGallery a').imageGallery({url:'$this->baseUrl'});";
		$divCode .= "});";
		$divCode .= "</script>";
		$divCode .= "<div id='myGallery'><ul></ul></div>";
		$divCode .= "</div></div></div>";
		return $divCode;
	
	}
	function yearbookTag($result, $type = 'user', $state = 1) {
		log_message ( "info", "state ==  >>> $state" );
		extract ( $result );
		$arrayImg = explode ( ",", $imageUrl );
		
		$strImg = "";
		foreach ( $arrayImg as $val ) {
			if (! empty ( $val ))
				$strImg .= "<img src='$val' width='109' height='109' />&nbsp;&nbsp;";
		}
		//$class=($type=='home')?'tdzy_rgd2':'bmlf_lf3';
		$divCode = ($type == 'home') ? "<div class='tdzy_rgd2'><div class='rgd2_d1'></div><div class='rgd2_d2 grzy_d2'><div class='home_yearbook_left'>" : " <div class='bmlf_lf3'>";
		//$divCode = " <div class='$class'>";
		$divCode .= "<div class='bmlf_lf31'>";
		$divCode .= "<span>&nbsp;$yearbookYearDate<br />$yearbookMDDate</span>";
		$divCode .= "</div>";
		$divCode .= "<div class='bmlf_lf32'>";
		$divCode .= "<p class='bmlf_lf321'>$character $address $content $inspiron</p>";
		$divCode .= "<p class='bmlf_lf322'>$strImg</p>";
		$divCode .= ($state == 1) ? "<p class='gr_p2' style='margin-left:480px;'><span><a style='cursor:pointer;' deleId='$id' class='eventClass' >删除</a></span></p>" : "";
		$divCode .= "</div>";
		$divCode .= "<div class='bmlf_lf33'></div>";
		$divCode .= ($type == 'home') ? "</div></div><div class='rgd2_d3'></div></div>" : "</div>";
		return $divCode;
	
	}
	function windowQzf($userTag, $assceptTag) {
		$divCode = "<div class='qzf_d01'><strong>你要祝福的人：</strong>$userTag</div>";
		$divCode .= "<div class='qzf_d01'><strong>你邀请的好友：</strong>$assceptTag</div>";
		$divCode .= "<p class='qzf_d01'><label><strong>祝福内容：</strong></label></p><textarea name='twContent' id='twContent' cols='' rows='' class='qzf_txtarea'></textarea>";
		return $divCode;
	}
	function windowPhotowall() {
		$userId = $this->CI->session->userdata ( "userId" );
		$divCode = "<script src='$this->baseUrl/assets/js/jcorp/uploadify.js' type='text/javascript'></script>";
		$divCode .= "<script src='$this->baseUrl/assets/js/grzy/windowPhotowall.js' type='text/javascript'></script>";
		$divCode .= "<script type='text/javascript'>$(document).ready(function() {windowPhotowall('$this->baseUrl','$userId');});</script>";
		$divCode .= '<input type="file" name="file_upload" id="file_upload" />';
		$divCode .= '<p>';
		$divCode .= '</p>';
		$divCode .= '<input type="hidden" value="1215154" name="tmpdir" id="id_file">';
		return $divCode;
	}
	function userDynamicVideo() {
		$divCode = "<!--视频部分-->";
		$divCode .= "<div class='vidio' id='user_dynamic_video'>";
		$divCode .= "<div class='insi_top_l'></div>";
		$divCode .= "<div class='insi_top_c'>";
		$divCode .= "<input type='hidden' name='type' value='video'>";
		$divCode .= "<div class='search1'><input type='text' name='path' class='sch_txt1' /></div>";
		$divCode .= "<div class='search1'><input type='text' name='description' class='sch_txt1' /> </div>";
		$divCode .= "<img src='' id='flashImg' class='inside_close'/><input type='button' id='user_dynamic_submit' class='inside_fb' /></div>";
		$divCode .= "<div class='insi_top_r'></div>";
		$divCode .= "</div>";
		$divCode .= "<!--视频部分-->";
		$jsCode = "$('input[name=\"path\"]').wjValidate({tip:'视频链接',error:'请填写年鉴里的人',button:$('#user_dynamic_submit'),validate:true,parent:'search1',src:'flashImg',isFlash:true,url:'$this->baseUrl/index.php/public_view/getFlashInfo'});";
		$jsCode .= "$('input[name=\"description\"]').wjValidate({tip:'视频描述',error:'请填写年鉴里的人',button:$('#user_dynamic_submit'),validate:false,parent:'search1'});";
		return array ('divCode' => $divCode, 'jsCode' => $jsCode );
	}
	function userDynamicLink() {
		$divCode = "<!--链接部分-->";
		$divCode .= "<div class='link' id='user_dynamic_link' >";
		$divCode .= "<div class='insi_top_l'></div>";
		$divCode .= "<div class='insi_top_c'>";
		$divCode .= "<p style='text-align:center;' class='linkParent'><input type='text' class='search1' name='content' /></p>";
		$divCode .= "<div class='link_area'>";
		$divCode .= "<p style='text-align:center;'>";
		$divCode .= "<input type='hidden' name='type' value='link'>";
		$divCode .= "<textarea  class='message_txtarea' rows='' cols='' name='description' value='' ></textarea>";
		$divCode .= "</p>";
		$divCode .= "<img src='$this->baseUrl/assets/images/zw_ms.gif' width='16' height='18' />";
		$divCode .= "</div><input type='button' id='user_dynamic_submit' class='inside_fb' /></div>";
		$divCode .= "<div class='insi_top_r'></div>";
		$divCode .= "</div>";
		$divCode .= "<!--链接部分-->";
		log_message ( "info", "divCode link==>" . $divCode );
		$jsCode = "$('input[name=\"content\"]').wjValidate({tip:'链接地址',error:'请填写连接地址',button:$('#user_dynamic_submit'),validate:true,parent:'linkParent'});";
		$jsCode .= "$('input[name=\"description\"]').wjValidate({tip:'描述信息',error:'请填写链接描述',button:$('#user_dynamic_submit'),validate:false});";
		return array ('divCode' => $divCode, 'jsCode' => $jsCode );
	}
	function userDynamicText() {
		$jsCode = '';
		$divCode = "<!--文字部分-->";
		$divCode .= "<div class='wz'  id='user_dynamic_text'>";
		$divCode .= "<div class='insi_top_l'></div>";
		$divCode .= "<div class='insi_top_c'><textarea class='inside_wz_bg' name='content' id='wz_text_area_id'  contentEditable='true' ></textarea>";
		$divCode .= "<ul class='wz_ico'>";
		//<p><span>120</span>/120</p>
		$divCode .= "<input type='hidden' name='type' value='text'>";
		$divCode .= "<li><input  type='button' class='bq_ico' id='bq_ico_div' /></li>";
		//$divCode .= "<li><input type='button' class='pic_ico' /></li>";
		//$divCode .= "<li><input type='button' class='link_ico' /></li>";
		$divCode .= "</ul>";
		$divCode .= "<input type='button' name='content' id='user_dynamic_submit' class='inside_fb' />";
		$divCode .= "</div><div class='insi_top_r'></div>";
		$divCode .= "</div>";
		$divCode .= "<!--文字部分-->";
		$jsCode = "$('input[name=\"content\"]').wjValidate({tip:'',error:'填写内容过多',button:$('#user_dynamic_submit'),validate:true});";
		$jsCode .= "$('#bq_ico_div').wjFace({divID:'bq_ico_div',textaraeId:'wz_text_area_id'});";
		return array ('divCode' => $divCode, 'jsCode' => $jsCode );
	}
	function userDynamicImage() {
		$divCode = "<!--图片部分-->";
		$divCode .= "<div class='insi_pic' id='user_dynamic_image' >";
		$divCode .= "<div class='insi_top_l'></div>";
		$divCode .= "<div class='insi_top_c'>";
		$divCode .= "<div class='upload_area'><input type='button'  class='upload_btn' /><input type='file' class='imgFile' id='imageFilePath' name='file'/></div>";
		$divCode .= "<div class='pic_txt_area'>";
		$divCode .= "<input type='hidden' name='type' value='image'>";
		$divCode .= "<textarea class='text_area' name='content' id='imgContent' contentEditable='true' ></textarea>";
		$divCode .= "</div>";
		$divCode .= "<div class='clear'></div>";
		$divCode .= "<div class='do_area'>";
		$divCode .= "<ul>";
		//$divCode .= "";
		$divCode .= "<li id='addImg' class='add_area'><input type='button' class='add_btn'/> </li>";
		$divCode .= "<span id='uploadCount'>已上传0张图片</span>";
		$divCode .= "</ul>";
		$divCode .= "</div><input type='button' class='inside_fb' id='user_dynamic_submit' style='margin-top:20px;'/></div>";
		$divCode .= "<div class='insi_top_r'></div>";
		$divCode .= "</div>";
		$divCode .= "<!--图片部分-->";
		$jsCode = "$('input[name=\"content\"]').wjValidate({tip:'图片描述',error:'请填写图片描述',button:$('#user_dynamic_submit'),validate:true});";
		$jsCode .= "$('#imageFilePath').wjImageShow({form:'user_dynamic_add',appendDiv:'addImg',url:'$this->baseUrl/index.php/sczp/imageUp/file',baseUrl:'$this->baseUrl/index.php/'})";
		return array ('divCode' => $divCode, 'jsCode' => $jsCode );
	}
	
	//utf-8中文截取，单字节截取模式
	function cn_substr_utf8($str, $length, $append = '...', $start = 0) {
		if (strlen ( $str ) < $start + 1) {
			return '';
		}
		preg_match_all ( "/./su", $str, $ar );
		$str2 = '';
		$tstr = '';
		//www.phpernote.com
		for($i = 0; isset ( $ar [0] [$i] ); $i ++) {
			if (strlen ( $tstr ) < $start) {
				$tstr .= $ar [0] [$i];
			} else {
				if (strlen ( $str2 ) < $length + strlen ( $ar [0] [$i] )) {
					$str2 .= $ar [0] [$i];
				} else {
					break;
				}
			}
		}
		return $str == $str2 ? $str2 : $str2 . $append;
	}
}
